UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'N8ZMl41pZJgpmTlgu4xpN89v+AcJnjXnn/fBRWXUeCg='
WHERE
key_id = 'fdc122d0230300a07c7c0f2f048c4ab8f4b8ea7417f8be2cb0586ccc7cced098'
AND (
token = 'N8ZMl41pZJgpmTlgu4xpN89v+AcJnjXnn/fBRWXUeCg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)