UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'A52n1BGL53Zi9HnQ5o5VIuC1rO0MT+ECWTKojeVwGTk='
WHERE
key_id = 'a84bde97b143de7a11973dc164ce2b4c3e99a6e3da55aa54b4137f1d54c545cc'
AND (
token = 'A52n1BGL53Zi9HnQ5o5VIuC1rO0MT+ECWTKojeVwGTk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)