UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'dm89Xfox7J7U1yd6mAevs+Ta1F/YYcq8j6N0cUD1cgE='
WHERE
key_id = '47cc630bb5f6e7957dace5eeb08a55383784425fa3afc00854c506207324a32c'
AND (
token = 'dm89Xfox7J7U1yd6mAevs+Ta1F/YYcq8j6N0cUD1cgE='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)