UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'YHAG7oGx7H0LqpsrjshjgZWqpXuqbxJMWm0NCHb8zGA='
WHERE
key_id = '4c9f1502864c69d5b45d26bf982dd4167de36baab55bf4014e6a1bc1c9ea83ec'
AND (
token = 'YHAG7oGx7H0LqpsrjshjgZWqpXuqbxJMWm0NCHb8zGA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)