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