UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'LQg5ssH+s1Q3hRYlOoOPMK9ZUTpwRUBrcMmHVUlY8Fk='
WHERE
key_id = '753a169888daf12e707fbdd02ba61ca6243b88eb9fdd425ca3335a2840c998ac'
AND (
token = 'LQg5ssH+s1Q3hRYlOoOPMK9ZUTpwRUBrcMmHVUlY8Fk='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)