UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'UfgNqf7slBCpx5PesdrUEKb/OtlzPqpu1ZnAWxySm7U='
WHERE
key_id = 'f5323629a2b826baf9ec9f1803dfcd0df1259e1d039f29198a2e3ab5b83f904a'
AND (
token = 'UfgNqf7slBCpx5PesdrUEKb/OtlzPqpu1ZnAWxySm7U='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)