UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'chZnhfi/G3wgiuFrXJp39NpHL8OD29mTNZvU4fbBw5k='
WHERE
key_id = 'e34788c68c4a12bf53def8653328eff0d28c47de9cc9dd1570d67a575be6ae30'
AND (
token = 'chZnhfi/G3wgiuFrXJp39NpHL8OD29mTNZvU4fbBw5k='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)