UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'LBO7yRLucujXVADPsCEV2r0hNDBcsBDDEbVjtZtifmA=' 
WHERE 
  key_id = '1f8a314534f2306f09a38c7d38f21763980f881745f11d3a3cae7f1248f59c00' 
  AND (
    token = 'LBO7yRLucujXVADPsCEV2r0hNDBcsBDDEbVjtZtifmA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029