UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'xw5liWJhTM00ouf51bfQfdaWJeu1hA9CRl3PBkHCkHQ='
WHERE
key_id = '0a51dc58739c4be2b13057a516c19003a9aa4697fbfe172cd3c77880e9dcd6e2'
AND (
token = 'xw5liWJhTM00ouf51bfQfdaWJeu1hA9CRl3PBkHCkHQ='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)