UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'MAJ32W+aygDE/IbwCFlEsujXMI/u4FeK4jBDVOuOZQY='
WHERE
key_id = 'a6be43a646aba62896f1345e76b3314aa57741ae550de2219203397bf9bc5e60'
AND (
token = 'MAJ32W+aygDE/IbwCFlEsujXMI/u4FeK4jBDVOuOZQY='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)