UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XD98zGvAA0d3ddMVq9D4mFSyYg0ABeVVeFyR+MYrGi0='
WHERE
key_id = 'e06c61d262964d4571422b0b27bcfca7ca108826c761452417934637d52d1f5c'
AND (
token = 'XD98zGvAA0d3ddMVq9D4mFSyYg0ABeVVeFyR+MYrGi0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)