UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'mpMp6Kw1VrV5KsdL90o++hjB4e8B+3XqA2tjmvE2po8='
WHERE
key_id = '5f0f89206728f180464cb04b3c9bb0b0794f1a0c4524c0c50c04345d4f285e4a'
AND (
token = 'mpMp6Kw1VrV5KsdL90o++hjB4e8B+3XqA2tjmvE2po8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)