UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'L6hI4Ik+V01eQqHdnMsiVA3jMVyCrfwMRYEAYUfMyFk=' 
WHERE 
  key_id = 'd1f6858497efeb03c3e7edb6268f14ac0eda9b862aaac3c817aab6ace3d347d1' 
  AND (
    token = 'L6hI4Ik+V01eQqHdnMsiVA3jMVyCrfwMRYEAYUfMyFk=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00029