UPDATE
cscart_lock_keys
SET
expiry_at = UNIX_TIMESTAMP(NOW()) + 30,
token = 'XGwv6yltLxfEsaRIeSl2bbs+HVfRkisjJHkyVTlOST4='
WHERE
key_id = 'c21e4ee390dde0b28e6dd1297492f09809e99e237f30ead5a174d025246d2f4f'
AND (
token = 'XGwv6yltLxfEsaRIeSl2bbs+HVfRkisjJHkyVTlOST4='
OR expiry_at <= UNIX_TIMESTAMP(NOW())
)