UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f6sAyyhpIxhrYjU/1Yi9hKq3oRlS64ajzZtYVxGsdkU='
WHERE
key_id = 'a0a89867c1b0119f6d7268baf6f76e9ea50c980ba5ac3d34b8b073277a9cdac9'
AND (
token = 'f6sAyyhpIxhrYjU/1Yi9hKq3oRlS64ajzZtYVxGsdkU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)