UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'AnmG/3oLXbNrDx9uP8xWDf+IDshoQjksAiuW66eFPG8='
WHERE
key_id = 'be0f9cf4659087cd3a98fa6801fcc1c369a58c1cbbd6978d36078fc2da9830a7'
AND (
token = 'AnmG/3oLXbNrDx9uP8xWDf+IDshoQjksAiuW66eFPG8='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)