UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '6kHw5FQsVlNnXy0Ei8rzSDUAeiNuBp+VQRlXQC2AGAI=' 
WHERE 
  key_id = 'cd798f71a561124addb8fe687b6cbf32ec989249ced7028a064555fad9ee78ba' 
  AND (
    token = '6kHw5FQsVlNnXy0Ei8rzSDUAeiNuBp+VQRlXQC2AGAI=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033