UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = '7c9tehPtqMoQ7RFlB54RK69dpUuMvHIBonISuXJT+n4='
WHERE
key_id = 'dbfc2e275e35fb307b54cba18957520a12a7e69c3269b135ebff8df102bbc360'
AND (
token = '7c9tehPtqMoQ7RFlB54RK69dpUuMvHIBonISuXJT+n4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)