UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'f8GYcf9EhOGYhgX8GIFGS+f9VIQKKNzRwbsnhCS+f+s='
WHERE
key_id = '1c58c2096ad26e648871c710989a9c78fc8886c85e4f227dae256fd6d7fc0853'
AND (
token = 'f8GYcf9EhOGYhgX8GIFGS+f9VIQKKNzRwbsnhCS+f+s='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)