UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'gFjIFCIVe5yn1bv0oq8SUu+vzCjar2uAjIJuTod/SD0='
WHERE
key_id = 'f639a8a7d5042d7322a2c4dc9a4683f450a1f4e307169a57e5b23a6aab64b4c2'
AND (
token = 'gFjIFCIVe5yn1bv0oq8SUu+vzCjar2uAjIJuTod/SD0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)