UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'G3fDbUkjRi0IOQMD3B1Kart8KzgAV9SiEe1I/PYnho0='
WHERE
key_id = 'cc48461372ac73cbed82b83fa2a74a3c4c95c8b5bf5212bdd67543cc85140e52'
AND (
token = 'G3fDbUkjRi0IOQMD3B1Kart8KzgAV9SiEe1I/PYnho0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)