UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'hK7vKTm8QnwikPsT2X0qUgIcYnCF8kX7KbNUerlb1Ts='
WHERE
key_id = 'c6a1efd05be44f899e255f7e3fdfe330dd48d51fdb5f318537174e8a3bfff0ff'
AND (
token = 'hK7vKTm8QnwikPsT2X0qUgIcYnCF8kX7KbNUerlb1Ts='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)