UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '5BZ6I5VDNYWNUVZC6cqez+u05PU8SF7IcK1u87HeVrs='
WHERE
key_id = '94ce5eab54139426a90d44de4ae2b1127510c814592d3d81b7900f74b4ceb3ad'
AND (
token = '5BZ6I5VDNYWNUVZC6cqez+u05PU8SF7IcK1u87HeVrs='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)