UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'PpcwKzRd42dnSwNOMATErT1qMOIEy+MSt6olLMQh1bY=' 
WHERE 
  key_id = 'e808821f6b52fe8807e1f906be86d1b474e537b0f8a459adc3161d5519b572a5' 
  AND (
    token = 'PpcwKzRd42dnSwNOMATErT1qMOIEy+MSt6olLMQh1bY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00037