UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'FfkEtKgWxW352YxUkd+UxGDWT0VrlhXkjsdye1tgTWA='
WHERE
key_id = 'a1dd9742812edebe45d365945e3b063d5dfad926dda21b90edaaa2c2d3ab1788'
AND (
token = 'FfkEtKgWxW352YxUkd+UxGDWT0VrlhXkjsdye1tgTWA='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)