UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DDYWegSXAYI1DhZ0dmSCFiRRj5HUhtUmIMnoVGyh2uE=' 
WHERE 
  key_id = 'a95c82f48962f1da3cca00f3722e22e9b8dd5cba671508d796e283883bebe7c1' 
  AND (
    token = 'DDYWegSXAYI1DhZ0dmSCFiRRj5HUhtUmIMnoVGyh2uE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032