UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iW1o2b51qdV5hP7zQTyytcE+CgUIBUi27CJ5NFSdFyc=' 
WHERE 
  key_id = '9842c9754edb309f391c193d385bd0f8f90241108b84287cb61de8f8ccc58a20' 
  AND (
    token = 'iW1o2b51qdV5hP7zQTyytcE+CgUIBUi27CJ5NFSdFyc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00041