UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'Czq3BNJXB/yhTjNn/p1owZRokeIAe0w5HQjuqHfa5lI='
WHERE
key_id = 'b854732bb3374bcce0b77a7dbb12c2a5ed5783cc55a76129c8708327ccb37376'
AND (
token = 'Czq3BNJXB/yhTjNn/p1owZRokeIAe0w5HQjuqHfa5lI='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)