UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'eWMgWFJmO5OUNZA644N8SD5Sua/RwEJWWc7Veuu3lF0=' 
WHERE 
  key_id = '012571697df614008b65829ad6cf1cdf09e43bf156861479b5aa6c66cce6e3d7' 
  AND (
    token = 'eWMgWFJmO5OUNZA644N8SD5Sua/RwEJWWc7Veuu3lF0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00045