UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'C0Q5wxaLBMaEbtEjCOmYWazWkviEwoEUif/529gZ6Z8='
WHERE
key_id = '28a173666118ab6c7019acafcde15a3aca517fe4096bea1edef6d9388437ab3b'
AND (
token = 'C0Q5wxaLBMaEbtEjCOmYWazWkviEwoEUif/529gZ6Z8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)