UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '/ipa5FGI73MUuzvg0CGX8RZpoM5V57Od9QiPR7pM64Y='
WHERE
key_id = '7ccc578728a836d03622c136bcfefe4de36de0ab1a870131bafc66f43057d769'
AND (
token = '/ipa5FGI73MUuzvg0CGX8RZpoM5V57Od9QiPR7pM64Y='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)