UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xFRHCvCtOy+CXiKnG2qnSZrPSeGC6MHrT05t+JOCrYc=' 
WHERE 
  key_id = '239e41ce98903f6b1c8c944c55c291040495bdda8f3bd6303937834d1108c10c' 
  AND (
    token = 'xFRHCvCtOy+CXiKnG2qnSZrPSeGC6MHrT05t+JOCrYc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00057