UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'VqIO9jO7unUwZcU6r0yAq87LEXpqfBVjhfms+4+1wLg='
WHERE
key_id = '2c1f122377ce99fce367c6641d7a14d2b0ffd8da12c046f2f955916b2d1d1358'
AND (
token = 'VqIO9jO7unUwZcU6r0yAq87LEXpqfBVjhfms+4+1wLg='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)