UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FA9tlqbNf39RvZQ6u1k8j8Z7ldplynZhpHKObus2+MM='
WHERE
key_id = 'b5529dc11b68febf855f77e1e1ddd8e70cf502894b95011dacbc66290ab6ae81'
AND (
token = 'FA9tlqbNf39RvZQ6u1k8j8Z7ldplynZhpHKObus2+MM='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)