UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '1ODAl6yMnZlGZDixrFQgbq2Wk5Pw+xVf/h+J9qPkvWI='
WHERE
key_id = '3a7457e938b1fb56f40900d4a4534a2760daaea7d3180fe0837addc4ef40a1a4'
AND (
token = '1ODAl6yMnZlGZDixrFQgbq2Wk5Pw+xVf/h+J9qPkvWI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)