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

Query time 0.00077