UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'toJ/ZYvD2EEbcKK7N1t3CFp5t+8xbcKKph4SnmAHPXU='
WHERE
key_id = 'd54a7ed0be641d511309a373b1be44324ab46db76692640665c247eff967d48c'
AND (
token = 'toJ/ZYvD2EEbcKK7N1t3CFp5t+8xbcKKph4SnmAHPXU='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)