UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'i14ARJC8qYnP3y1bWFsLfVu7VA3yCWrdHUEZfznnW40='
WHERE
key_id = '15ca068e569512deb787f1ed3fb00f5067ea4e6bb67acd81a39500f5bb43bde0'
AND (
token = 'i14ARJC8qYnP3y1bWFsLfVu7VA3yCWrdHUEZfznnW40='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)