UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '2cpgUH+edmAqijtq0GELxCUEhO9eLiwhHShtbgwyew0=' 
WHERE 
  key_id = '800dc170c3835ea817da586920e3d1ce83ffc3d49aa547162e70ec457ddff6b4' 
  AND (
    token = '2cpgUH+edmAqijtq0GELxCUEhO9eLiwhHShtbgwyew0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026