UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '4fGbrV0LvFddAkOezs2Qbb+lZpzpLb8vWaUZ9XpNjMg='
WHERE
key_id = '977046f74e6233fb11de68cd79d7346500f463b6f54b3a4f8fe6bb45d9940fbc'
AND (
token = '4fGbrV0LvFddAkOezs2Qbb+lZpzpLb8vWaUZ9XpNjMg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)