UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'CLMjdqmraEtCoYCTsD/qoM39PVmLHbWjhytxXZ99Et0='
WHERE
key_id = 'af9e8a81a459a2bc987795ca5db2acb8718921315df3496dcbd239997f07f731'
AND (
token = 'CLMjdqmraEtCoYCTsD/qoM39PVmLHbWjhytxXZ99Et0='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)