UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Soq9pgQWdHeY+MUtD4j7IpcafGcNM/iMVZ+Br74fNDU=' 
WHERE 
  key_id = 'a383a9d1dbb5c23834db67246f0f6c964c102074810f956dc0a33b9b10d0529d' 
  AND (
    token = 'Soq9pgQWdHeY+MUtD4j7IpcafGcNM/iMVZ+Br74fNDU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00082